// 周湘程代码
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  sort(s.begin(), s.end());

  string ans = s;
  do {
    if (s[0] != '0' && s < ans)
      ans = s;
  } while (next_permutation(s.begin(), s.end()));
  cout << ans << endl;
  return 0;
}